import React, { Component } from 'react'
import { Table, Tag, Space } from 'antd';
import axios from 'axios'
export default class RoleList extends Component {
  state = {
    dataSource: [
      {
        key: '1',
        name: '胡彦斌',
        age: 32,
        address: '西湖区湖底公园1号',
      },
      {
        key: '2',
        name: '胡彦祖',
        age: 42,
        address: '西湖区湖底公园1号',
      },
    ]
  }
  componentDidMount() {
    this.getRoleList()
  }
  getRoleList = () => {
    axios.get('http://localhost:8000/right').then(res => {
      console.log("res", res)
      this.setState({
        dataSource:res.data
      })
    })
  }
  render() {
    const columns = [
      {
        title: 'ID',
        dataIndex: 'id',
        key: 'name',
      },
      {
        title: '权限名称',
        dataIndex: 'title',
        key: 'age',
      },
      {
        title: '权限路径',
        dataIndex: 'key',
        key: 'address',
      },
    ];
    return (
      <div>
        <Table dataSource={this.state.dataSource} columns={columns} />;
      </div>
    )
  }
}
